import { createStore } from "vuex";

// vue2: new Vuex.Store({})
const store = createStore({
    state() {
        return {
            count: 1
        }
    },
    mutations: {
        add(state, payload) {
            state.count += payload
        }
    },
    actions: {
        addAsync(context, payload) {
            setTimeout(() => {
                context.commit('add', payload)
            }, 1000);
        }
    }
})
export default store